#include<iostream>
#include "EquationSolver.h"
#include <cmath>  
using namespace std;

// B.1 
class Func1 : public Function {
    public:
        virtual double operator()(const double &x){
            return 1.0 / x - tan(x);
        }
}func1;


// B.2
class Func2 : public Function{
    public:
        virtual double operator()(const double &x){
            return 1.0 / x - pow(2, x);
        }
}func2;

// B.3
class Func3 : public Function{
    public:
        virtual double operator()(const double &x){
            return pow(2, -x) + exp(x) + 2 * cos(x) - 6;
        }
}func3;

// B.4
class Func4 : public Function{
    public:
        virtual double operator()(const double &x){
            return  (((x + 4) * x + 3) * x + 5) / (((2 * x - 9) * x + 18) * x - 2);
        }
}func4;

int main(){
    cout << "B.1"  << endl; 
    BisectionSolver(func1, 0, M_PI/2,  eps, 100).solve();
    cout << "B.2" <<  endl;
    BisectionSolver(func2, 0, 1,  eps, 100).solve();
    cout << "B.3" << endl; 
    BisectionSolver(func3, 1, 3,  eps, 100).solve();
    cout << "B.4"  << endl; 
    BisectionSolver(func4, 0, 4,  eps, 100).solve();
    
}
